package com.hspedu.homework.homework13;

public class  Homework13{
    public static void main(String[] args) {
        Person[] persons=new Person[4];
        persons[0]=new Student("张三",'女',20,"10001");
        persons[1]=new Student("张四",'男',22,"10002");
        persons[2]=new Teacher("李四",'男',28,1);
        persons[3]=new Teacher("王五",'男',32,3);

        for (int i = 0; i < persons.length; i++) {
            if (persons[i] instanceof  Student){

                ((Student) persons[i]).printInfo();
            }else if (persons[i] instanceof  Teacher){
                ((Teacher) persons[i]).printInfo();
            }else if (persons[i] instanceof Person){
                System.out.println("不符合要求的信息");
            }
        }
    }
}